
import 'package:Flutter_Demo/ui/pages/filter/fliter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/extention/double_extention.dart';

class MYHomeDrawerContent extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: <Widget>[
          buildHeader(context),
          buildContent(context, Icon(Icons.restaurant), "进餐", () {
            Navigator.of(context).pop();
          }),
          buildContent(context, Icon(Icons.settings), "过滤", () {
            Navigator.of(context).pushNamed(MYFliterScreen.routeName);
          })
        ],
      ),
    );
  }

  Widget buildHeader(BuildContext context) {
    return Container(
      height: 120.0.px,
      color: Colors.orange,
      margin: EdgeInsets.only(
        bottom: 20.0.px,
      ),
      alignment: Alignment(0, 0.5),
      child: Text("开始动手", style: Theme.of(context).textTheme.headline4.copyWith(fontWeight: FontWeight.bold),),
    );
  }

  Widget buildContent(BuildContext context, Widget icon, String title, Function handle) {
    return Container(
      padding: EdgeInsets.fromLTRB(20.0.px, 5.0.px, 0, 0),
      child: ListTile(
        leading: icon,
        title: Text(title, style: Theme.of(context).textTheme.headline6),
        onTap: handle,
      ),
    );
  }


}
